package com.example.pkmedical.Activity;

import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;


import com.example.pkmedical.R;
import com.example.pkmedical.Utils.ToastUtils;

public class PadLockActivity extends Activity {

    RelativeLayout relativeLayout;
    EditText mEditText;
    Button mOkButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_padlock);
        relativeLayout = findViewById(R.id.padlock_background);
        relativeLayout.getBackground().setAlpha(200);
        initView();
    }

    private void initView() {
        mEditText = findViewById(R.id.padlock_edit);
        mOkButton = findViewById(R.id.button_padlock);
        mOkButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (TextUtils.isEmpty(mEditText.getText().toString())) {
                    ToastUtils.show(PadLockActivity.this, "密码不可为空");
                } else {
                    if ("123456".equals(mEditText.getText().toString())) {
                        PadLockActivity.this.finish();
                    } else {
                        ToastUtils.show(PadLockActivity.this, "密码不正确");
                    }
                }
            }
        });
    }
}
